<!--
  Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.

  https://www.mall4j.com/

  未经允许，不可做商业用途！

  版权所有，侵权必究！
-->

<template>
  <div class="Mall4j store-list-container">
    <div class="store-list-pages">
      <div class="store-top">
        <floor-title-component
          :config="titleConfig"
          :type="'storeMore'"
        />
      </div>
      <div class="store-bottom">
        <store-list-component :config="storeConfig" />
      </div>
    </div>
  </div>
</template>
<script setup>
import floorTitleComponent from '../goods-component/floor-title-component/index.vue'
import storeListComponent from '../goods-component/store-list-component/index.vue'

const props = defineProps({
  itemComponent: { // 当前组件的信息
    type: Object,
    default: () => {}
  }
})

const titleConfig = ref({
  mainContent: {
    title: '优选好店',
    fontSize: '16px',
    color: '#333'
  },
  background: '',
  marginTop: '0px',
  marginBottom: '0px',
  showMore: 0,
  path: {
    link: '',
    name: '',
    type: '3'
  },
  moreTextColor: '#999',
  showSubTitle: 0,
  subContent: {
    title: '副标题',
    fontSize: '12px',
    color: '#999'
  }
}) // 标题配置

const storeConfig = ref({}) // 店铺配置

watch(() => props.itemComponent, (newVal) => {
  if (JSON.stringify(newVal.rightConfigMessage) !== '{}') {
    titleConfig.value = {
      mainContent: { // 主标题
        title: '优选好店',
        fontSize: newVal.rightConfigMessage.mainFontSize + 'px', // 主标题文字大小
        color: newVal.rightConfigMessage.mainTextColor // 主标题颜色
      },
      background: newVal.rightConfigMessage.bgColor, // 标题的背景颜色
      marginTop: newVal.rightConfigMessage.marginTop + 'px', // 上边距
      marginBottom: newVal.rightConfigMessage.marginBottom + 'px', // 下边距
      showMore: 0,
      path: {
        link: '',
        name: '',
        type: '3'
      },
      moreTextColor: '#999',
      showSubTitle: newVal.rightConfigMessage.showSubTitle, // 是否展示副标题
      subContent: {
        title: newVal.rightConfigMessage.subTitle,
        fontSize: newVal.rightConfigMessage.subFontSize + 'px',
        color: newVal.rightConfigMessage.subTextColor
      }
    }
    // 店铺列表展示
    storeConfig.value = {
      storeList: newVal.rightConfigMessage.storeList
    }
  }
}, {
  immediate: true,
  deep: true
})

</script>
<style lang="scss" scoped>
.store-list-container {
  width: 100%;
  overflow: hidden;
}

.store-list-pages {
  width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
</style>
